#{extends 'main.html'/}
<div id="layout1">
    <div  position="center" title="表扬信、花篮等统计">
        <!--  <div id="state"  style="background-color:#C4E1FF;height:18px;font-size:2; color:#003D79;text-align:center; width: 100%;font-weight: bolder" >选择：</div>  --> 
        <div class="l-clear"></div>
        <div id="navtab1" style="width: 800px;overflow:hidden; border:1px solid #A3C0E8; ">          
            <div  title="查询条件" style="">
                <div id="detail"  style="margin-top:1px">
                    <form id="queryform"  method="post"></form>               
                </div>  <br> <br/>  
                <table width="60%">
                    <tr>
                        <td width="50%">&nbsp;</td><td><div id="btnSet" ></div></td>            
                        <td >&nbsp;&nbsp;</td>
                        <td><div id="btnReset" ></div></td>                     
                    </tr>
                    <tr><td>&nbsp;</td></tr>
                </table>
            </div> 

        </div>  
        <div id="navtab1" style="width: 800px;overflow:hidden; border:1px solid #A3C0E8; ">                  
            <div   title="档案列表">
                <div id="maingrid" style="margin-top:1px"></div> <br />
                <div style="display:none;"></div>             
            </div>    
        </div>  
    </div>
</div>

<script type="text/javascript">  
    $(function () {    
      
       
        
        var manager, grid;
        $("#layout1").ligerLayout({ leftWidth: 160,height: 450});
        $("#navtab1").ligerTab(); 

        //var votekills=[];
      
        // var grades=[{"id":1,name:"优秀"},{"id":2,name:"良好"},{"id":3,name:"一般"},{"id":3,name:"较差"}];
        var depts=[];
        var queryform = $("#queryform");
        function f_initGrid()
        {     
            grid = manager = $("#maingrid").ligerGrid({
                columns: [
                    //{ display: '序号', name:'0', width: 60,  type: 'textarea' },
                    { display: '年度', name:'0', width: 80,  type: 'textarea' },
                    { display: '科室', name:'1', width: 120,  type: 'textarea' },  
                    { display: '表扬信', name:'2', width: 120,  type: 'textarea' },  
                    { display: '锦旗', name:'3', width: 120,  type: 'textarea' },  
                    { display: '花篮', name:'4', width: 120,  type: 'textarea' },  
                    { display: '礼品盒', name:'5', width: 120,  type: 'textarea' }  
                         
                ],
                //url:'detailfilejson?tag='+tag, 
                method: "GET", title: "表扬信、花篮等列表",	            
                width: '100%', height:'98%',pageSize: 30, showTitle: true, checkbox: false, checkboxColWidth: 50
            });
        }
        
        f_initGrid();
        var  fieldsarr=[];
        function f_initquery() {       
            fieldsarr=[                                          
                { display: "年度", name: "year", newline: true, 
                    labelWidth: 60, width: 120, space: 30, type: "text"},                                
                { display: "科室", name: "deptHide", comboboxName: "deptCombox", newline: false, 
                    labelWidth: 50, width: 120, space: 50, type: "select",
                    options: {data: depts, valueField: 'id', textField: 'name'} }   
            ];
         
            queryform.ligerForm({
                inputWidth: 280,
                fields: fieldsarr,
                pageSize: 50,       				
                toJSON: JSON2.stringify
            });
                      
            managerbtn = $("#btnSet").ligerButton({
                click: function () {         
                    query();   
                }
            });
            managerbtn.setValue('查询');
            
            managerreset = $("#btnReset").ligerButton({
                click: function () {         
                    resetform();   
                }
            })
            managerreset.setValue('重置');
            var d=new Date();       //默认为今年
            var fullyear=d.getFullYear();
            $("[name$=year]").val(fullyear);    
	 
        }

     
        $.getJSON('/depts/findAll', function(data) {                          
            depts = data;  
            f_initquery();     
        });
        
        
        
        function f_reload() {
            grid.loadData();
        }
       
          
        function query(){              
            $.ajax({
                loading: '正在查询中...',
                type: 'POST',
                url: 'commendcountjson',                  
                data: $("#queryform").serialize(),
                dataType:"json",
                success: function (jsondata){  
                   
                    grid.setOptions({ data: jsondata }); 
                    grid.loadData();  
                    
                },
                error: function (message)
                {
                    LG.tip(message);              
                }
            });    
        }
        
        function resetform(){   
            $("[name$=year]").val("");         
            $("#deptCombox").ligerGetComboBoxManager().setValue();    
        }
        
    })
           
</script>


